package com.huishao.demo.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.huishao.demo.mapper.SshKeyMapper;
import com.huishao.demo.entity.SshKey;
import com.huishao.demo.service.SshKeyService;
import org.springframework.stereotype.Service;
import com.huishao.demo.common.PageResult;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.huishao.demo.utils.MybatisPlusUtil;

/**
 * 用于存储服务器的ssh秘钥信息(SshKey)表服务实现类
 *
 * @author makejava
 * @since 2023-03-13 09:28:29
 */
@Service("sshKeyService")
public class SshKeyServiceImpl extends ServiceImpl<SshKeyMapper, SshKey> implements SshKeyService {

    @Override
    public PageResult getPage(Integer currentPage, Integer size, SshKey sshKey) {
        Page<SshKey> page = new Page<>(currentPage, size);

        QueryWrapper<SshKey> queryWrapper = MybatisPlusUtil.queryWrapperBuilder(sshKey);

        this.page(page, queryWrapper);

        return new PageResult((int) page.getTotal(), page.getRecords());
    }
}

